package vn.codespot.hms;

import vn.codespot.hms.slidingmenu.SlidingActivityBase;
import vn.codespot.hms.slidingmenu.SlidingActivityHelper;
import vn.codespot.VisaVietNamAndroid.R;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.webkit.WebView;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;

public class DisclaimerActivity extends AbstractActivity implements SlidingActivityBase {

    private SlidingActivityHelper mHelper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        mHelper = new SlidingActivityHelper(this);
        setMenu(mHelper);
        mHelper.onCreate(savedInstanceState);
        View v_behide = getLayoutInflater().inflate(R.layout.menu_layout, null);
        setBehindContentView(v_behide);
        View v = getLayoutInflater().inflate(R.layout.disclaimer_layout, null);
        setContentView(v);
        setBehindOffset(100);
        setSlidingActionBarEnabled(true);
        ImageButton mBtnShowMenu = (ImageButton) v.findViewById(R.id.btnShowMenu);
        final RadioGroup radGroupMenu = (RadioGroup) v_behide.findViewById(R.id.radGroupMenu);
        final RadioButton radDisclaimer = (RadioButton) v_behide.findViewById(R.id.radDisclaimer);
        radDisclaimer.setChecked(true);
        mBtnShowMenu.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                toggle();
            }
        });

        radGroupMenu.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if (mHelper.isShowMenu()) {
                    Intent intent = null;
                    toggle();
                    switch (checkedId) {
                    case R.id.radRegister:
                        intent = new Intent(DisclaimerActivity.this, RegisterActivity.class);
                        startActivity(intent);
                        break;
                    case R.id.radCheckFees:
                        intent = new Intent(DisclaimerActivity.this, CheckFeesActivity.class);
                        startActivity(intent);
                        break;
                    case R.id.radCheckStatus:
                        intent = new Intent(DisclaimerActivity.this, CheckStatusActivity.class);
                        startActivity(intent);
                        break;
                    case R.id.radContactUs:
                        intent = new Intent(DisclaimerActivity.this, ContactUsActivity.class);
                        startActivity(intent);
                        break;
                    case R.id.radHowToUse:
                        intent = new Intent(DisclaimerActivity.this, HowToUseActivity.class);
                        startActivity(intent);
                        break;
                    case R.id.radSupport:
                        intent = new Intent(DisclaimerActivity.this, SupportActivity.class);
                        startActivity(intent);
                        break;
                    case R.id.radDisclaimer:
                        break;
                    case R.id.radHistory:
                        intent = new Intent(DisclaimerActivity.this, HistoryActivity.class);
                        startActivity(intent);
                        break;
                    }
                    radGroupMenu.check(R.id.radDisclaimer);
                }
            }
        });

        WebView wv = (WebView) findViewById(R.id.webview);
        wv.loadUrl("file:///android_asset/Disclaimers.html");
    }

    @Override
    public void onBackPressed() {
        // TODO Auto-generated method stub
        return;
    }
}
